<%@page pageEncoding = "utf-8" contentType = "text/html;charset=utf-8"%>

<%@taglib prefix = "c" uri = "http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix = "fmt" uri = "http://java.sun.com/jsp/jstl/fmt"%>
<%@taglib prefix = "fn" uri = "http://java.sun.com/jsp/jstl/functions"%>

<script type="text/javascript">
var fromRegistrationDate, toRegistrationDate, fromEndDate, toEndDate;
window.onload = function () {
  fromRegistrationDate  = new Epoch('fromRegistrationDate','popup',document.getElementById('fromRegistrationDate'));
  toRegistrationDate  = new Epoch('toRegistrationDate','popup',document.getElementById('toRegistrationDate'));
  fromEndDate  = new Epoch('fromEndDate','popup',document.getElementById('fromEndDate'));
  toEndDate  = new Epoch('toEndDate','popup',document.getElementById('toEndDate'));
};
</script>
 
<h2>Поиск заявок</h2>

<div class = "messages"><jsp:include page = "/messages.jsp"/></div>

<div id="box">

<!-- start search form -->
<form action="operatorui" method="post" name="searchform" id="dispatcher_searchform">
<table class="form">
  <tr>
    <td>
    <table class="form">
      <tr>
        <td class="label"><fmt:message key="request.client" /></td>
        <td><input name="client_query"
          value='<c:out value="${param['client_query']}"/>'></td>
      </tr>
      <tr>
        <td class="label"><fmt:message key="request.organization" /></td>
        <td><input name="organization_query"
          value='<c:out value="${param['organization_query']}"/>'>
        </td>
      </tr>
      <tr>
        <td class="label"><fmt:message key="request.text" /></td>
        <td><input name="text_query"
          value='<c:out value="${param['text_query']}"/>'></td>
      </tr>
      <tr>
        <td class="label"><fmt:message key="request.status" /></td>
        <td><select name="status_query">
          <c:forEach var="status" items="${statusList}">
            <option value="${status.id}" ${status.id==param["status_query"] ? "selected" : ""}>${status.status}
                </option>
          </c:forEach>
        </select></td>
      </tr>
      <tr>
        <td class="label"><fmt:message key="request.id" /></td>
        <td><input name="id_query"
          value="<c:out value='${param["id_query"]}'/>"></td>
      </tr>
      <tr>
        <td class="label"><fmt:message key="request.regNumber" /></td>
        <td><input name="regnumber_query"
          value='<c:out value="${param['regnumber_query']}"/>'>
        </td>
      </tr>
    </table>
    </td>

    <td>

    <table cellspacing="0" cellpadding="0" border="0" align="center">
      <tr>
        <td colspan="4">Дата регистрации:</td>
      </tr>
      <tr>
        <td>От:</td>
        <td>
          <input 
            id="fromRegistrationDate" 
            type="text" 
            name="fromRegistrationDate" 
            value='<fmt:formatDate value="${fromRegistrationDate}" pattern="dd.MM.yyyy"/>'
            style="width: 150px;"
          >
        </td>      
        <td>До:</td>
        <td>
          <input 
            id="toRegistrationDate" 
            type="text" 
            name="toRegistrationDate" 
            value='<fmt:formatDate value="${toRegistrationDate}" pattern="dd.MM.yyyy"/>'
            style="width: 150px;"
          >
        </td>
      </tr>
      
      <tr>
        <td colspan="4">Дата выполнения:</td>
      </tr>
      
      <tr>    
        <td class="title2">От:</td>
        <td>
          <input 
            id="fromEndDate" 
            type="text" 
            name="fromEndDate" 
            value='<fmt:formatDate value="${fromEndDate}" pattern="dd.MM.yyyy"/>'
            style="width: 150px;"
          >
        </td>
        <td>До:</td>
        <td>
          <input 
            id="toEndDate" 
            type="text" 
            name="toEndDate" 
            value='<fmt:formatDate value="${toEndDate}" pattern="dd.MM.yyyy"/>'
            style="width: 150px;"
          >
        </td>
      </tr>
    </table>        
    
    </td>
  </tr>
</table>

<input type="hidden" name="_action" value="processRequestSearchForm"> 
<input type="submit" name="submit" value="Найти"> 

</form>
<!-- end search form -->

</div>